<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
   <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title><fmt:message key="alterarDados"/></title>
        <link rel="stylesheet" media="all" href="${pageScope.request.contextPath}css/estilos.css">
        <link rel="stylesheet" media="all" href="${pageScope.request.contextPath}css/bootstrap.css">
        <script type="text/javascript" src="js/funcoes.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="js/jquery-1.7.1.min.js"><\/script>')</script>
    </head>
   <body class="body-sessao">
        <div id="image-logo">
          <c:import url="${pageScope.request.contextPath}/imports/fundo.jsp"/>
        </div>
        <div id="logo">
         <c:import url="${pageScope.request.contextPath}/imports/fundo2palha.jsp"/>
      </div>
        <div id="barra-titulo">
           <c:import url="${pageScope.request.contextPath}/imports/barraTituloSessaoUser.jsp"/> 
        </div>
        <div id="conteudo-logomarca">
          <img src="img/logomarca.jpg">
          <p>
              <fmt:message key="conteudo-logomarca"/>
          </p>
      </div>
        <font class="title"><fmt:message key="titulo-alteracao-user"/> </font>
        <div id="formulario">
           <c:if test="${erroCadastroBanco != null}" >
             <font class="erro"><fmt:message key="erroCadastroBanco"/> </font>
           </c:if>
           <c:if test="${erroProcessamento != null}">
		     <font class="erro"><fmt:message key="erroProcessamento" /></font>
		   </c:if>
		   <br>
           <form action="controleuser" method="post">
             <input type="hidden" name="acao" value="alterar"/>
             <input type="hidden" name="id" value="${usuario.id}"/>
             <table>
                <tr>
                   <td>
		             <label><fmt:message key="nome" /></label>
				   </td>
				   <td>
					 <input type="text" name="nome" size="35" value="${sessionScope.usuario.nome}" /> 
					 <c:if test="${erroNome != null}">
						<font class="erro"><fmt:message key="erroNome" /></font>
					 </c:if> 
				   </td>
                </tr>
                <tr>
                  <td>
                     <label><fmt:message key="sexo" /></label>
                  </td>
                  <td>
                    <c:forEach items="${sexos.valores}" var="sexo">
                       <input type="radio" name="sexo" value="${sexo}" <c:if test="${sessionScope.usuario.sexo == sexo}"> checked="checked" </c:if> /> <font class="label"> <c:if test="${sexo == 'MASCULINO'}"> <fmt:message key="sexo-masculino"/> </c:if> <c:if test="${sexo =='FEMININO'}"> <fmt:message key="sexo-feminino"/> </c:if> </font>
                    </c:forEach>
                     <c:if test="${erroSexo != null}">
                         <font class="erro"><fmt:message key="erroSexo"/> </font>
                     </c:if>
                  </td>
                </tr>
                <tr>
                  <td>
                     <label><fmt:message key="dataNascimento" /></label>
                  </td>
                  <td>
                     <input type="text" name="dataNascimento" size="35" maxlength="10" value='<fmt:formatDate value="${usuario.dataNascimento}"/>' onkeypress="javascript:mascara(this, '##/##/####')"/>
                     <c:if test="${erroData != null}">
                         <font class="erro"><fmt:message key="erroData"/> </font>
                     </c:if>
                     <c:if test="${menorIdade != null}">
                         <font class="erro"><fmt:message key="erro-menor-idade"/> </font>
                     </c:if>
                  </td>
                </tr>
                <tr>
                  <td>
					<label><fmt:message key="cpf"/></label>
				  </td>
				  <td>	
					<input type="text"	name="cpf" value="${sessionScope.usuario.cpf}" size="35" maxlength="11" disabled="disabled" />
				  </td>
				</tr>
				 <tr>
				   <td>
					 <label><fmt:message key="email" /></label> 
				   </td>
				   <td>	 
					 <input type="text" name="email" value="${sessionScope.usuario.email}" size="35" disabled="disabled"/>
				   </td>
				 </tr>
				 <tr>
				   <td>	 
					 <label><fmt:message key="ddd"/></label>
				   </td>
				   <td>
				  	 <input type="text" name="ddd" value="${sessionScope.usuario.telefone.ddd}" size="35" maxlength="2" />
					 <c:if test="${erroDDD != null}">
						<font class="erro"><fmt:message key="erroDDD" /></font>
					 </c:if> 
					 <c:if test="${excecaoDDD != null}">
						<font class="erro"><fmt:message key="excecaoDDD" /></font>
					 </c:if> 
				   </td>
				 </tr>
				 <tr>
				   <td>	 
					 <label><fmt:message key="numero" /></label>
				   </td>
				   <td>	 
					 <input type="text" name="numero" value="${sessionScope.usuario.telefone.numero}" size="35" maxlength="9" />
					 <c:if test="${erroNumero != null}">
						<font class="erro"><fmt:message key="erroNumero" /></font>
					 </c:if> 
				   </td>
				 </tr>
				 <tr>
				   <td>	 
					 <label><fmt:message key="estado" /></label> 
			   	   </td>
			   	   <td>
			   	      <select name="estado" class="dropdown">	 
					    <c:forEach var="uf" items="${estados}"> 
					       <option value="${uf}" ${sessionScope.usuario.endereco.estado == uf ? 'selected' : ''}> ${uf}</option>    
					    </c:forEach>
					  </select>
				   </td>
				 </tr>
				 <tr>
				   <td>	
					 <label><fmt:message key="cidade" /></label> 
		           </td>
		           <td>  
		             <input	type="text" name="cidade" value="${sessionScope.usuario.endereco.cidade}" size="35" />
					 <c:if test="${erroCidade != null}">
						<font class="erro"><fmt:message key="erroCidade" /></font>
					 </c:if> 
				   </td>
				 </tr>
				 <tr>
				   <td>
					  <label><fmt:message key="complemento" /></label> 
					</td>
					<td>
					  <input	type="text" name="complemento" value="${sessionScope.usuario.endereco.complemento}" size="35" />
					  <c:if test="${erroComplemento != null}">
						<font class="erro"><fmt:message key="erroComplemento" /></font>
					  </c:if>
					</td>
			     </tr>
			     <tr>
				   <td>
					  <label><fmt:message key="login" /></label> 
					</td>
					<td>
					  <input	type="text" name="login" value="${sessionScope.usuario.login}" size="35" disabled="disabled" />
					</td>
			     </tr>
			     <tr>
				   <td>
					  <label><fmt:message key="senha" /></label> 
					</td>
					<td>
					  <input	type="password" id="inputPassword" name="senha" value="${sessionScope.usuario.senha}" size="35" />
					  <c:if test="${erroSenha != null}">
						<font class="erro"><fmt:message key="erroSenha" /></font>
					  </c:if>
					</td>
			     </tr>
			</table>
			<br /> <br/>
            <input type="submit" class="btn btn-primary" value='<fmt:message key="enviar"/>'/>
           </form>
        </div>
    </body>
</html>